package com.lmt.ymcc.feignclient;

import com.lmt.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author: Amazing
 * @Date: 2022/8/14 15:10
 * @Version: 1.0
 */
@Component
public class CourseFeignFallbackFactory implements FallbackFactory<CourseFeignClient> {

    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JSONResult checkUserLearn(Long loginId, Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("服务降级");
            }

            @Override
            public JSONResult info(String courseIds) {
                throwable.printStackTrace();
                return JSONResult.error("服务降级");
            }
        };
    }
}